/**
* @Copyright Copyright (C) 2012 - JoniJnm.es
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/

LCA_COOKIE_TIME_SAVED = 1440; //in minutes
var lca_month_opened = 0;
var lca_year_opened = 0;

function lca_open(img, id) {
	if (img)
		document.getElementById(id).src = LCA_EXPAND;
	else
		document.getElementById(id).innerHTML = LCA_EXPAND;
}
function lca_close(img, id) {
	if (img)
		document.getElementById(id).src = LCA_COLLAPSE;
	else
		document.getElementById(id).innerHTML = LCA_COLLAPSE;
}
function flca(n, id, img) {
	var li = "lca_"+n+"_"+id;
	var a = "lca_"+n+"a_"+id;
	if (document.getElementById(li)) {
		if (document.getElementById(li).style.display == "none") {
			document.getElementById(li).style.display = "";
			document.cookie = 'lca'+n+'='+id;
			lca_open(img, a);
		}
		else {
			document.getElementById(li).style.display = "none";
			document.cookie = 'lca'+n+'=0;expires=0';
			lca_close(img, a);
		}
	}
	var opened = n==1 ? lca_month_opened : lca_year_opened;
	li = 'lca_'+n+'_'+opened;
	if (document.getElementById(li) && ((n==1 && lca_month_opened!=id) || (n!=1 && lca_year_opened!=id))) {
		document.getElementById(li).style.display = "none";
		lca_close(img, "lca_"+n+"a_"+opened);
	}
	if (n == 1)
		lca_month_opened = id;
	else
		lca_year_opened = id;
}